package com.jdd.modules.system.model;

import com.jdd.dao.entity.TProject;
import com.jdd.modules.people.model.TProjectTreeModel;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: LS
 * @Date: 2022 - 09 - 20 - 15:14
 * @Description: 项目表封装树
 * @version: 1.0
 */
@Data
public class TProjectIdModel {
    private static final long serialVersionUID = 1L;
    /**
     * 主键ID
     */
    private String key;

    /**
     * 主键ID
     */
    private String value;

    /**
     * 项目名称
     */
    private String title;

    List<TProjectIdModel> children = new ArrayList<>();

    public TProjectIdModel convert(TProjectTreeModel tProjectTreeModel){
        this.key = tProjectTreeModel.getId();
        this.value = tProjectTreeModel.getId();
        this.title = tProjectTreeModel.getName();
        return this;
    }

    /*该方法为项目转换使用*/
    public TProjectIdModel convertByProject(TProject tProject){
        this.key = tProject.getId();
        this.value = tProject.getId();
        this.title  = tProject.getName();
        return  this;
    }


}
